//
//  LDCellBottomView.swift
//  Weibo201655
//
//  Created by pro on 16/5/10.
//  Copyright © 2016年 LeeDan. All rights reserved.
//

import UIKit

class LDCellBottomView: UIView {

    override init(frame: CGRect) {
        super.init(frame: frame)
        backgroundColor = UIColor.orangeColor()
        setupUI()
    }

    required init?(coder aDecoder: NSCoder) {
        fatalError("init(coder:) has not been implemented")
    }

    private func setupUI() {
        
        addSubview(forwardButton)
        addSubview(commentButton)
        addSubview(likeButton)
        addSubview(separatorViewFirst)
        addSubview(separatorViewSecond)
        
        let rate = 1 / 3.0
        //布局
        forwardButton.snp_makeConstraints { (make) -> Void in
            make.leading.top.bottom.equalTo(self)
            make.width.equalTo(self).multipliedBy(rate)
        }
        
        commentButton.snp_makeConstraints { (make) -> Void in
            make.leading.equalTo(forwardButton.snp_trailing)
            make.top.bottom.equalTo(self)
            make.width.equalTo(self).multipliedBy(rate)
        }
        
        likeButton.snp_makeConstraints { (make) -> Void in
            make.leading.equalTo(commentButton.snp_trailing)
            make.top.bottom.equalTo(self)
            make.width.equalTo(self).multipliedBy(rate)
        }
        
        //分割线
        separatorViewFirst.snp_makeConstraints { (make) -> Void in
            make.centerX.equalTo(forwardButton.snp_trailing)
            make.centerY.equalTo(forwardButton)
        }
        
        separatorViewSecond.snp_makeConstraints { (make) -> Void in
            make.centerX.equalTo(commentButton.snp_trailing)
            make.centerY.equalTo(commentButton)
        }
        
    }
    
    
    //MARK:----------------------- 懒加载 ----------------------------------//
    //转发按钮
    private lazy var forwardButton: UIButton = UIButton(imgName: "timeline_icon_retweet", bgImgName: "timeline_card_bottom_background", title: "转发")
    //评论按钮
    private lazy var commentButton: UIButton = UIButton(imgName: "timeline_icon_comment", bgImgName: "timeline_card_bottom_background", title: "评论")
    //点赞按钮
    private lazy var likeButton: UIButton = UIButton(imgName: "timeline_icon_unlike", title: "赞")
    //分割线1
    private lazy var separatorViewFirst: UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line"))
    //分割线2
    private lazy var separatorViewSecond: UIImageView = UIImageView(image: UIImage(named: "timeline_card_bottom_line"))
}
